Skip to content

fix: name the ref, the fault and the next steps when the pharn-oss archive is refused (CORE-388) - #447

Merged
PrzemekGalarowicz merged 4 commits into
mainfrom
fix/archive-refusal-message
Nov 25, 2026
Merged

PrzemekGalarowicz merged 4 commits into
mainfrom
fix/archive-refusal-message

Conversation

@PrzemekGalarowicz

@PrzemekGalarowicz PrzemekGalarowicz commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Refs CORE-380

What

During CORE-380 every user saw only ⚠ tar entry has an unsupported type '2': …, with nothing to say the published pharn-oss archive was at fault, that no flag gets past the check, or what to try.

A refused archive now reads like this (release channel):

⚠ pharn-oss release v7.25.5 (commit <40-hex>) was refused: its published archive failed pharn's checks. The problem is in that pharn-oss archive, not in your project; nothing in your project was changed.
Reason: tar entry has an unsupported type '2': pharn-oss-1755d6b/.claude/skills/pharn-ci-cover
No option skips this check: forcing an update or answering yes does not help. Next steps:
- install the tip of main instead: `pharn init --ref main` (`pharn update --ref main` for an existing install)
- upgrade pharn (`npm install -g @pharn-dev/pharn@latest`): a newer pharn may accept this archive
- or re-run once pharn-oss publishes a fixed release, and report this at https://github.com/pharn-dev/pharn-oss/issues

On main the first line is pharn-oss main at commit <sha> (or (refs/heads/main, commit not resolved)), and the steps offer --ref latest and "re-run later, once main is fixed". --ref accepts only main and latest, so no other value is suggested.

How

  • New src/lib/archive-refusal.ts. fetchRepo (lib/repo.ts) notes a TarExtractError or ManifestValidationError (exactly those two) with the ref it fetched, using a WeakMap. It then re-throws the error unchanged, so instanceof callers and the CORE-386 extractor rewrite keep their contract. fetchAt and tar-extract.ts are untouched.
  • init, update (both the real run and the dry run), add and status pass archiveRefusalMessage(err) as the CliError.failure message. The raw error stays the fatal cause, so PHARN_DEBUG=1 dumps it (for example TarExtractError: …) in place of the hint.
  • Network failures, the release-resolution refusal, and the refusal of a malformed main SHA (GitHub's answer, not an archive) are not noted, so their messages are unchanged.
  • The "nothing in your project was changed" sentence holds for every command, because each one fetches before its first project write. The init test asserts it: the snapshot is unchanged, with no pharn.config.json, no .claude/ and no lock left. The update test does the same.
  • The message deliberately does not contain the literal --force: an existing status test asserts that a refused fetch never mentions it.

Tests

  • The tar fixture can emit a symlink entry (links), and the harness exposes it as upstream.links. The symlink sits at a manifest-declared path, so these tests stay valid once CORE-386 unpacks only listed paths.
  • tests/commands/init.test.ts:
    • release channel: tag, commit, steps, project unchanged
    • main channel: SHA and --ref latest
    • main channel with the commit unresolved
    • manifest sha256 mismatch
    • PHARN_DEBUG=1 dumps the raw error
  • tests/commands/update.test.ts: release run, and a main --dry-run.
  • tests/archive-refusal.test.ts: which errors are noted (including network and ReleaseResolveError passing through), the malformed SHA, escaping, and that only --ref values the CLI accepts appear.
  • No existing test title was renamed or removed. release-consistency gets v0.21.5 in KNOWN_TAGS plus the new link lines.

Docs: docs/troubleshooting.md gets the new section "The pharn-oss archive was refused" and an updated example in "A pharn-oss release was refused". The module and test maps are updated, and the CHANGELOG has a 0.21.7 entry.

Version: 0.21.7. 0.21.6 is reserved for CORE-386, so package.json, the lock and the CHANGELOG will conflict with it; I'll renumber after whichever lands first.

Local gates (format, lint, lint:md, typecheck, test:coverage, build) are all green.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Archive validation failures now explain which release or main commit was refused, why it was rejected, and confirm that project files were left unchanged.
    • Error messages provide next steps, including how to try another reference. Enable PHARN_DEBUG=1 for the original error details.
  • Documentation
    • Updated troubleshooting guidance with information about archive refusals and recovery steps.
  • Release
    • Updated version and changelog information for 0.21.7.

…chive is refused (CORE-388)

A refused archive (a TarExtractError from the extractor, or a
ManifestValidationError from the manifest/sha256/SKILLS_VERSION checks)
printed only the check. fetchRepo now notes such a refusal with the ref it
fetched (release tag + commit, or main + commit) and re-throws it unchanged;
init, add, update and status ask lib/archive-refusal.ts for the message:
the ref, that the published pharn-oss archive (not the project) is at
fault, the original reason escaped, that no option skips the check, and
only next steps the CLI has (--ref main / --ref latest, upgrade, report).
PHARN_DEBUG=1 still dumps the raw error. Network and release-resolution
errors pass through unchanged.

Refs CORE-380

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

pharn

🛡️ pharn-ci · ✅ Pass

Tip

Pass · Diff coverage of this change is 100% against a threshold of 80%; 33 agent setup files found.

Verdict Diff coverage Test integrity Agent setup
✅ Pass 100% (threshold 80%) none (block) 33 files

🧪 Diff coverage

▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ 100%

100% of changed lines covered (28/28, threshold 80%)

Changed files (6)
File Coverage Covered Uncovered lines
src/commands/add.ts 100% 3/3
src/commands/init.ts 100% 1/1
src/commands/status.ts 100% 2/2
src/commands/update.ts 100% 2/2
src/lib/archive-refusal.ts 100% 15/15
src/lib/repo.ts 100% 5/5

🔍 Test integrity

No test-integrity findings (mode: block).

Tests changed: +20 −0 ~0
Test file Added Removed Modified Renamed
tests/archive-refusal.test.ts 7 0 0 0
tests/commands/add.test.ts 1 0 0 0
tests/commands/init.test.ts 5 0 0 0
tests/commands/status.test.ts 2 0 0 0
tests/commands/update.test.ts 2 0 0 0
tests/repo.test.ts 3 0 0 0

🤖 Agent setup (33 files)

Agent setup: 33 files · amp, claude-code, codex, copilot, cursor, jules, opencode, zed

Agent setup files (33)
Path Kind
.claude/commands/pharn-dev-build.md claude-command
.claude/commands/pharn-dev-eval.md claude-command
.claude/commands/pharn-dev-grill.md claude-command
.claude/commands/pharn-dev-memory-promote.md claude-command
.claude/commands/pharn-dev-plan.md claude-command
.claude/commands/pharn-dev-regress.md claude-command
.claude/commands/pharn-dev-review.md claude-command
.claude/commands/pharn-dev-ship.md claude-command
.claude/commands/pharn-dev-verify.md claude-command
.claude/hooks/enforce-writes-scope.cjs claude-hook
.claude/hooks/enforce-writes-scope.test.cjs claude-hook
.claude/hooks/git-worktree-fixture.cjs claude-hook
.claude/hooks/protect-trusted-paths.cjs claude-hook
.claude/hooks/protect-trusted-paths.test.cjs claude-hook
.claude/hooks/session-root.cjs claude-hook
.claude/hooks/session-root.test.cjs claude-hook
.claude/hooks/set-writes-scope.cjs claude-hook
.claude/hooks/set-writes-scope.test.cjs claude-hook
.claude/settings.json claude-settings
.claude/skills/phargus-diagnose claude-skill
.claude/skills/phargus-memory claude-skill
.claude/skills/phargus-rules claude-skill
.claude/skills/phargus-setup claude-skill
.claude/skills/phargus-verify claude-skill
.claude/skills/pharn-ci-cover claude-skill
.claude/skills/pharn-ci-explain claude-skill
.claude/skills/pharn-ci-fix claude-skill
.claude/skills/pharn-ci-install claude-skill
.claude/skills/pharn-ci-policy claude-skill
.claude/skills/pharn-cli claude-skill
.claude/skills/security-audit claude-skill
AGENTS.md agents-md
CLAUDE.md claude-md

pharn-ci 0.12.0 · report schema v2 · coverage format lcov

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 289d481 and 56ed2d8.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 20

  • CHANGELOG.md
  • CLAUDE.md
  • docs/contributing.md
  • docs/troubleshooting.md
  • package.json
  • src/commands/add.ts
  • src/commands/init.ts
  • src/commands/status.ts
  • src/commands/update.ts
  • src/lib/archive-refusal.ts
  • src/lib/repo.ts
  • tests/archive-refusal.test.ts
  • tests/commands/add.test.ts
  • tests/commands/init.test.ts
  • tests/commands/status.test.ts
  • tests/commands/update.test.ts
  • tests/release-consistency.test.ts
  • tests/repo.test.ts
  • tests/support/harness.ts
  • tests/support/tar-fixture.ts

No actionable comments were generated in the recent review.

Walkthrough

The fetch path now records diagnostic messages for selected archive refusals. init, add, status, and update use those messages in failure output. Tests cover refusal details and unchanged project state. Documentation and release metadata are updated for version 0.21.7.

Changes: Archive refusal diagnostics

Layer / File(s) Summary
Record refusal messages during fetch
src/lib/archive-refusal.ts, src/lib/repo.ts, tests/archive-refusal.test.ts, tests/repo.test.ts, tests/support/*, CLAUDE.md, docs/contributing.md
The fetch path records formatted messages for selected archive errors and rethrows the original error. Tests cover message content, excluded errors, and symbolic-link archives. Project maps list the module and its tests.
Show refusal messages in commands
src/commands/{add,init,status,update}.ts, tests/commands/{init,update}.test.ts, docs/troubleshooting.md
The commands include recorded refusal text in failure output. Tests cover release and main refusals, recovery suggestions, debug output, and unchanged project state. Troubleshooting guidance describes archive checks and next steps.
Release documentation and metadata
package.json, CHANGELOG.md, tests/release-consistency.test.ts
The package version and changelog comparison links are updated for 0.21.7. The release-consistency test allowlist includes v0.21.5.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: Minimal · previous review 289d4 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the three main parts of the change: the ref, the fault, and the next steps for a refused pharn-oss archive. The summaries show a refusal message that identifies the fetched release or …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the three main parts of the change: the ref, the fault, and the next steps for a refused pharn-oss archive. The summaries show a refusal message that identifies the fetched release or main commit, states the project was not changed, and gives recovery steps. The title matches the main change. It is specific and does not use vague terms. The length of 96 characters is long, but it is still one clear sentence.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 51a96d2 and 289d481.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 18

  • CHANGELOG.md
  • CLAUDE.md
  • docs/contributing.md
  • docs/troubleshooting.md
  • package.json
  • src/commands/add.ts
  • src/commands/init.ts
  • src/commands/status.ts
  • src/commands/update.ts
  • src/lib/archive-refusal.ts
  • src/lib/repo.ts
  • tests/archive-refusal.test.ts
  • tests/commands/init.test.ts
  • tests/commands/update.test.ts
  • tests/release-consistency.test.ts
  • tests/repo.test.ts
  • tests/support/harness.ts
  • tests/support/tar-fixture.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

… archive (CORE-388)

init, add and status stopped their spinner with "Failed to fetch" or
"Failed to reach" even when the archive was downloaded and refused, which
contradicted the new message. They now stop with "pharn-oss archive
refused" when fetchRepo noted a refusal; any other failure keeps its line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep 0.21.7 above 0.21.6; re-apply the fetchRepo refusal note over the
narrowed extractor; the command tests pin its new listed-path reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PrzemekGalarowicz
PrzemekGalarowicz merged commit 5ed3424 into main Nov 25, 2026
15 checks passed
@PrzemekGalarowicz
PrzemekGalarowicz deleted the fix/archive-refusal-message branch November 25, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant